<?php
include('class/YouTube.php');
$YoutubeCode = mres(($_POST['url']));
$description = mres(($_POST['description']));
$tags = mres(($_POST['tags']));
$username = mres(($_POST['username']));
$kategorija = mres($_POST['kategorija']);

if ($kategorija=="0") {
    $kategorija = mres($_POST['nova_kategorija']);
}

preg_match('#(/embed/|/v/|/watch\?v=)([A-Za-z0-9_-]{5,11})#', $YoutubeCode, $matches);
$YoutubeCode = $matches[2];

$yt = getVideo($YoutubeCode);


insertVideo($YoutubeCode,$username,$description,$tags, $kategorija, $yt['title']);


header('Location: ?page=video');


?>
